const { verToken } = require('./token')

module.exports = (req, res, next) => {
  console.log(req.headers['authorization']);
  var token = req.headers['authorization'];
  if (token == undefined) {
    return next();
  } else {
    verToken(token).then((data) => {
      req.data = data;
      console.log(data);
      return next();
    }).catch((error) => {
      return next();
    })
  }
}
